import http from '@/utils/request'
//购买-提交订单
// ***products // 购买的商品信息，数据格式如下，一个商品信息组成的数组
// [{
//   product:1,
//   amount: 1,
// }, {
//   product:2,
//   amount: 1
// }],

function postProToOrderReq(products, receiver, address) {
  return http({
    method: 'post',
    url: '/api/v1/orders',
    data: { products, receiver, address },
  })
}

//获取订单列表(根据状态(支付状态、订单状态))
function getOrderStatusReq(page = 1, per = 10, order_status, pay_status) {
  return http({
    method: 'get',
    url: '/api/v1/orders',
    data: { page, per, order_status, pay_status },
  })
}


//获取订单详情

function getOrderDetailsReq(id) {
  return http({
    method: 'get',
    url: '/api/v1/orders/'+id,
  })
}

export { postProToOrderReq, getOrderStatusReq,getOrderDetailsReq }
